import React,{ Component } from 'react';
import '../index/index.scss';
import './myCard.scss';
import './user.scss';
import { employeeInfo } from 'api/user.js';
export default class MyCard extends Component{
	constructor (props) {
		super(props)
		this.state={
			userInfo: {}
		}
	}
	goBack () { //返回上一级
		this.props.history.goBack()
	}
	componentDidMount(){
		document.title = '我的名片'
		employeeInfo().then(res => {
			if (res.code === 1) {
				this.setState({
					userInfo: res.data
				})
			}
		})
	}
	render(){
		return(
			<div className="myCard user">
				{/*<div className="title">
					<div onClick={this.goBack.bind(this)}><i className="glyphicon glyphicon-left"></i></div>
					<div>我的名片</div>
					<div></div>
				</div>*/}
				<div className="user_header myCard_header">
					<div className="user_card">
						<div className="user_card_header">
							<img src={this.state.userInfo.employee_img} alt="lalal"/>
							<div>
								<p className="user_name">{this.state.userInfo.employee_name}</p>
								<span className="user_position">{this.state.userInfo.position_name}</span>
							</div>
						</div>
						<p className="user_company">{this.state.userInfo.company_name}</p>
						<p>电话：{this.state.userInfo.telephone}</p>
						<p>邮箱：{this.state.userInfo.email}</p>
					</div>
				</div>
				<div className="labelMy_content">
					<img src={this.state.userInfo.opacity_two_bar_code} alt="lalal"/>
					<p>长按查看小程序名片</p>
				</div>
			</div>
		)
	}
}